package com.rome.hotel.framework.config;

import com.rome.hotel.common.utils.file.minio.MinIOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Minio 配置信息
 *
 * @author ruoyi
 */
@Configuration
//@ConfigurationProperties(prefix = "minio")
public class MinioConfig {
    /**
     * 服务地址
     */
    @Value("${minio.url}")
    private String url;

    /**
     * 用户名
     */
    @Value("${minio.access-key}")
    private String accessKey;

    /**
     * 密码
     */
    @Value("${minio.secret-key}")
    private String secretKey;

    /**
     * 存储桶名称
     */
    @Value("${minio.bucket-name}")
    private String bucketName;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }

    @Bean
    public MinIOUtils creatMinioClient() {
        return new MinIOUtils(url, bucketName, accessKey, secretKey);
    }
}
